UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YuuQUP3pcHpu3tnhoEkAp6AyZ/wNn81+13GuIm5dtM4='
WHERE
key_id = 'f4f7295b3765448f4b5e300165c8d73edd2cc6e5e97b3781812308b155cd6591'
AND (
token = 'YuuQUP3pcHpu3tnhoEkAp6AyZ/wNn81+13GuIm5dtM4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)