UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W6Da/gWi+OzTndSRmoUxMlst86YNquzE4K6EpTw7eXA=' 
WHERE 
  key_id = 'db7975517d4c1f8361c9b909051f1ed2d2cffb4c60ad7b7e5fa06db5cd8d657e' 
  AND (
    token = 'W6Da/gWi+OzTndSRmoUxMlst86YNquzE4K6EpTw7eXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025