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

Query time 0.00026