UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fuuU1DPmwsdbozFrPcb59VMpp1qMGLhoYHNAfUOg3d0=' 
WHERE 
  key_id = '18c3300cc2b9e591465be192ff0f19ac153cad988e0bd2c1f5c5d5165dd600cd' 
  AND (
    token = 'fuuU1DPmwsdbozFrPcb59VMpp1qMGLhoYHNAfUOg3d0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037