UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gpbh2fQpQLD3o+mB0YYfOEG7m+BseMnx0p2TZ+ceC9E=' 
WHERE 
  key_id = '50fdba5c7d04cd9dd0d0b81c73f46f8b1694d8b029e374534fbc0788a2ed06cd' 
  AND (
    token = 'Gpbh2fQpQLD3o+mB0YYfOEG7m+BseMnx0p2TZ+ceC9E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023