UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LvQKjbYuYqY8SdikKjihzz5YZp2xCiEkYLVKWuA5p3w='
WHERE
key_id = 'd7ce9d45b54df5537e76fe8a5ca032a0486d62c5b9d3ec32cddfd208f39fb7f1'
AND (
token = 'LvQKjbYuYqY8SdikKjihzz5YZp2xCiEkYLVKWuA5p3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)