UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JuAfKZD4fwPvaSrZnNFkFoeO8fNqwLzo1IWKGsmqLTQ=' 
WHERE 
  key_id = 'c517d31b5becdd5e1cf248115b31be048c5b818535afdc6bf7403d4b3f80c563' 
  AND (
    token = 'JuAfKZD4fwPvaSrZnNFkFoeO8fNqwLzo1IWKGsmqLTQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038