UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U7UWCIU+Uwrr+p1xPQzjIo6IjXzB2QRRvRI3jZa2rt8=' 
WHERE 
  key_id = '2df57e83607dbe1b6b0a944386bc5e94069b76791b52797543dc2835d20c4155' 
  AND (
    token = 'U7UWCIU+Uwrr+p1xPQzjIo6IjXzB2QRRvRI3jZa2rt8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043