UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z/Jr1StLbRn7bK7siTjzly5Fz5mBBxYBlbtNRHN/HU4='
WHERE
key_id = 'fdac92121747f73e28befdac8a07bc6c8204e513d17ae0b690955958d3142d6c'
AND (
token = 'z/Jr1StLbRn7bK7siTjzly5Fz5mBBxYBlbtNRHN/HU4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)