UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6x47ruAr7Bl6dwd0/cN/yfHStlZ0GBKihAzGfwL89xM='
WHERE
key_id = '1cf83afc30b41320036609fd8825aaf1cb68d1dc60c2858b7f48c6275e85a134'
AND (
token = '6x47ruAr7Bl6dwd0/cN/yfHStlZ0GBKihAzGfwL89xM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)