UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sA41vcr1kirC1kwrQvsBrYrEcW5fXhWyYdBdvRcOqcw='
WHERE
key_id = '38008bf32ad0ab85e86eacbd613026eb29e17c8bea6ba9cc5388a05a60827f3d'
AND (
token = 'sA41vcr1kirC1kwrQvsBrYrEcW5fXhWyYdBdvRcOqcw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)