UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YCPBAqf3CZUWOGZbns+0e6TFK3d/7XAmL/gJ+0VHT4M=' 
WHERE 
  key_id = 'fe2ceb03939f667077d677ee55c16135d436c76848374d78c9239b638e955c86' 
  AND (
    token = 'YCPBAqf3CZUWOGZbns+0e6TFK3d/7XAmL/gJ+0VHT4M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029