UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'avEHeMGkO0HqZz+DfbHcNPAD2y/UKT/pV0PvFXy12Dw='
WHERE
key_id = 'a18e68a3ae73d298e2d19c2f4ff2a3c5d0f10605cba2e79df9944b272ef283d3'
AND (
token = 'avEHeMGkO0HqZz+DfbHcNPAD2y/UKT/pV0PvFXy12Dw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)