UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sVlRlEVP6+Nl/62f4HkRrdtk7VQ7qT4gVl6rHnrTOkA=' 
WHERE 
  key_id = '1aa23c40b890a808f060dd17e4004487221fff61c70a01cc2062cfecaef62869' 
  AND (
    token = 'sVlRlEVP6+Nl/62f4HkRrdtk7VQ7qT4gVl6rHnrTOkA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046