UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QiuuxrzSugvx8SmD1ElRK+d+hjhfRTmqi/zepYFtb4c='
WHERE
key_id = '59633b4bd30e31c282131137129aca33a2debb8b0f17bc37feeaf91807638169'
AND (
token = 'QiuuxrzSugvx8SmD1ElRK+d+hjhfRTmqi/zepYFtb4c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)