UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UwdVdh7+U2MCt6RSwYNjkhUzJcvyyE28nfFWpD8RQHU=' 
WHERE 
  key_id = '1bb63502525a536447e933822741ef548b765d5ad133ee553551eda535a056aa' 
  AND (
    token = 'UwdVdh7+U2MCt6RSwYNjkhUzJcvyyE28nfFWpD8RQHU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042