UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1ciLfejt/OHp7mrbI/pY40YtsDQQPSyz462Ue33vaMc=' 
WHERE 
  key_id = '956cf9bac17022a5c1bb00e0f1e358db5b09062c6902187810e258c159215871' 
  AND (
    token = '1ciLfejt/OHp7mrbI/pY40YtsDQQPSyz462Ue33vaMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064