UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rMlA+y89HDvVYwop8OuykHhCcyvrxoxTDF8o6dEFCdM=' 
WHERE 
  key_id = 'a316d18b2a1160d3ca58272bf77d8c9f25ba3df50a39754deb0813a55a7ce25f' 
  AND (
    token = 'rMlA+y89HDvVYwop8OuykHhCcyvrxoxTDF8o6dEFCdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016