UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c+FXH9I6cEEOhMAovMFUtp0Fzs4bCQ/+fzu22KNYFEY=' 
WHERE 
  key_id = 'e1c0a652873a83c83955c09d50209f0e579c01a2da0b6abb8465628eac1efab7' 
  AND (
    token = 'c+FXH9I6cEEOhMAovMFUtp0Fzs4bCQ/+fzu22KNYFEY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045