UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'huj79TA0FfvJ7xgENSUCCB4WZb9I/hM8xXNxDaHLBhI=' 
WHERE 
  key_id = '1b8ea842c11b39b6d532507e634ee03e50dae00dd44e676dbabfdcf16d879f99' 
  AND (
    token = 'huj79TA0FfvJ7xgENSUCCB4WZb9I/hM8xXNxDaHLBhI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037