UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KeIjYAqWlHeBzp9KnR4A2P3YE7DMMPkxJnOv8R2t6r0='
WHERE
key_id = '4d82da42c5ffa2d19cfd5ef4714f2abe5e68ce9e214831abec0554b40e4f92c3'
AND (
token = 'KeIjYAqWlHeBzp9KnR4A2P3YE7DMMPkxJnOv8R2t6r0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)