UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qsR6heNbCYeVsdr1qu1TbwBf0kStM10sZubxhSVQV4w='
WHERE
key_id = '9652ca72229bbfb155fb676d0d80a5d86540b831c4d362cfdb6b655bc68cd67e'
AND (
token = 'qsR6heNbCYeVsdr1qu1TbwBf0kStM10sZubxhSVQV4w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)