UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W8I3ARRJ7Hh9eTSBEhU1B/MS6tdSHYw00e8A+vD16pk=' 
WHERE 
  key_id = '9925690cc5613531c6bed0e060a544b9a2619c0d92c1a224d9601f31bdd9ff51' 
  AND (
    token = 'W8I3ARRJ7Hh9eTSBEhU1B/MS6tdSHYw00e8A+vD16pk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028