UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XCMUK3H7DHWirIeyT7uMaBTRU3hVvRs6MkgRF6dNCN4=' 
WHERE 
  key_id = '1dd82774a090f6b68226b12ca798343298a6dfa9b897665e3c43e4ea276f4c07' 
  AND (
    token = 'XCMUK3H7DHWirIeyT7uMaBTRU3hVvRs6MkgRF6dNCN4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032