UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bJqKELk1Kuq8S2fzL15j3FeHteJe9UTX8xKb9jCsI5g=' 
WHERE 
  key_id = '5b593fe505bcdcbd6a718a1a9ce6d29623d77f017733690bcd9770b93241656f' 
  AND (
    token = 'bJqKELk1Kuq8S2fzL15j3FeHteJe9UTX8xKb9jCsI5g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023