UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y2E+YLwibiCkFjWotm/1KVdrhjzlngsBp5TaWY9pMzA=' 
WHERE 
  key_id = '87a9821c5a4fa3f78cf9876d36114c0c6c792435572fc5d1e4f9b388d44d0444' 
  AND (
    token = 'Y2E+YLwibiCkFjWotm/1KVdrhjzlngsBp5TaWY9pMzA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021