UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OE04qBwy4R9HeJ7e+yHRoeokoKmczoCW9StuvwlslmE=' 
WHERE 
  key_id = 'a9ab482369730f1a16a0b6607938de91e5c79c34abdd4108f3ba42c0832d14e4' 
  AND (
    token = 'OE04qBwy4R9HeJ7e+yHRoeokoKmczoCW9StuvwlslmE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037