UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NbfTjCIaBKWzrk5qEvv6b+vxZPZm/Gur6vUAis39Lz8='
WHERE
key_id = 'a545469321c30f3bc8caa5ea8cca9d53033d0702744cf520b03fed2a66957632'
AND (
token = 'NbfTjCIaBKWzrk5qEvv6b+vxZPZm/Gur6vUAis39Lz8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)