UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tGjF0eQ2W13UcezGaKo6srAQiWOL8ejSCNDzdulgzMU=' 
WHERE 
  key_id = '7c0252eb9eb420f654e47b01642b65990a559c9f91afa312faeb557f91cb8799' 
  AND (
    token = 'tGjF0eQ2W13UcezGaKo6srAQiWOL8ejSCNDzdulgzMU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041