UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4hHfgIEES/isqMugt2gZRYlrlUSuxitCUivYyz/NNHs=' 
WHERE 
  key_id = '8ca823eea725f70b2ae3396b33efc5bc8fa1f2960e201bac00bc5c75f0a77ae2' 
  AND (
    token = '4hHfgIEES/isqMugt2gZRYlrlUSuxitCUivYyz/NNHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063