UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PoZIVSeTTRrrd/Y2B4Hbshk/CsVqHeQNgTBdHl1wzwU=' 
WHERE 
  key_id = '9c6f6658ecc31d5438a311fff25a4f208742266b467d5ba3d7c7bbea371027ba' 
  AND (
    token = 'PoZIVSeTTRrrd/Y2B4Hbshk/CsVqHeQNgTBdHl1wzwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026