UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LAF66RCRlY0+kiKzLOGDKuEEulXAEsS2OmHeNB+AlcQ=' 
WHERE 
  key_id = '00ce33ccce14e5c7d30a79994b971f10e7b51b5f03743e5dede51a0aec392a35' 
  AND (
    token = 'LAF66RCRlY0+kiKzLOGDKuEEulXAEsS2OmHeNB+AlcQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039