UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lI5xOQa6T2qdevkuZjLLhGQph0Lpqf3UCsCo7BczNuI='
WHERE
key_id = '0012ce709623b2831bb692b4577f64d20c36c5321e87326926d0641cb5b752b3'
AND (
token = 'lI5xOQa6T2qdevkuZjLLhGQph0Lpqf3UCsCo7BczNuI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)