UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xULkok5JfsEmvBreI2GWdg+PluT9iy3xcuRu4Ds0kX4='
WHERE
key_id = 'd01a4a865b10047df3d291a3e576d74955e0851dffbd3f4df60e88b2d882d0b6'
AND (
token = 'xULkok5JfsEmvBreI2GWdg+PluT9iy3xcuRu4Ds0kX4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)