UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lXzioWm1oI9YCGZqoanlrTEkERgkX+t03pLQJLyh+Gg=' 
WHERE 
  key_id = '1c72075a44b153bc9880275c0517988e83a8bed6dc8736a1ab3a1375eb7be56e' 
  AND (
    token = 'lXzioWm1oI9YCGZqoanlrTEkERgkX+t03pLQJLyh+Gg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030