UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lnyBi0KZGDBkPwwL0+MRPQ6A/fUoLjWs1oPwEyTwW+0='
WHERE
key_id = 'b386759b7960f582f3675961c917c545712077e12742d06b76311f215addeae6'
AND (
token = 'lnyBi0KZGDBkPwwL0+MRPQ6A/fUoLjWs1oPwEyTwW+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)