UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bczhl1cYrU0tVZkDHgNh6YHV0aQtv5Ev5J2JxsmB8IU=' 
WHERE 
  key_id = '49ff630a683f1f3e759ae23116c2a4ab03efd5f71e61a96ff9a5a8c0c246034d' 
  AND (
    token = 'bczhl1cYrU0tVZkDHgNh6YHV0aQtv5Ev5J2JxsmB8IU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025