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

Query time 0.00050