UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bTg/zOgYyOYk2Q1u95fVcOH0SssncsCIHV5dNkAON4g='
WHERE
key_id = 'c6a4770f5c400db1e998e258087ce9cf2136d39d1f19b07c1993429a55241efd'
AND (
token = 'bTg/zOgYyOYk2Q1u95fVcOH0SssncsCIHV5dNkAON4g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)