UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hSvExU7o1w87ar7Q4nZ3e9dxfr0x8/LzGN2WZEr/hyo=' 
WHERE 
  key_id = '9a1b7554b29919e052c21e3ff3dd813be767403abd5230015800de33e4bb0e2a' 
  AND (
    token = 'hSvExU7o1w87ar7Q4nZ3e9dxfr0x8/LzGN2WZEr/hyo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048