UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p9WcurEcgz3EeIeB2pUDr6dGu8ULtGNkrOihNinGRII=' 
WHERE 
  key_id = '02f9cb7248ab3451aa5c88f6c8177934e6aa9ba3a01aa39afe48fd86744e77c8' 
  AND (
    token = 'p9WcurEcgz3EeIeB2pUDr6dGu8ULtGNkrOihNinGRII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031