UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lrNNZ92IFaKaFJtjcf1LKb9uEize56qPE7/6O0X+Ku4='
WHERE
key_id = '1debc257e6a1363f6ab1d791ad66f9288c357e199ad38b9201d82e44802adf01'
AND (
token = 'lrNNZ92IFaKaFJtjcf1LKb9uEize56qPE7/6O0X+Ku4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)