UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'La4eQ22Ot0maSBwcCNUSZQtX11Y95du5ZinT5NHNL10=' 
WHERE 
  key_id = 'e4dd81246fc6d627296501bf3e83493a6d7159d755220fe09c0585950bce8919' 
  AND (
    token = 'La4eQ22Ot0maSBwcCNUSZQtX11Y95du5ZinT5NHNL10=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022