UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '82/iehdiwTRhCE8epIcJ9d8VGDnB8CJN3xbVcCrAPqw='
WHERE
key_id = 'b90e3bf591c46175d6333fb547f76e3da31831598994eb29f4a329262a3b169e'
AND (
token = '82/iehdiwTRhCE8epIcJ9d8VGDnB8CJN3xbVcCrAPqw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)