UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm+NmIVm+tgI2xn9BX3crCvGYomdmFmPdVcoE5tMkgN8='
WHERE
key_id = '5c1e4c65954d3ce6457a89dae2af311e7fa256d2a6c2818f74a2990c217247d2'
AND (
token = 'm+NmIVm+tgI2xn9BX3crCvGYomdmFmPdVcoE5tMkgN8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)