UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KwBS1WpBT7b9CN2H80tsyYXcCoiB0joPCmaPmIcP7Kg=' 
WHERE 
  key_id = '6690ba647211341215754eb4d31de897640f18d6d1c70db4a2c669ed87b59e26' 
  AND (
    token = 'KwBS1WpBT7b9CN2H80tsyYXcCoiB0joPCmaPmIcP7Kg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029