UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7zqJ1BQPrRQWvPkbf4PbnfXTRfdT57pm2NC6SCTD62I='
WHERE
key_id = 'a3ee9bb2370ccbd015ef846cbc228155329c1a838e7e908db1a84c33fe375d89'
AND (
token = '7zqJ1BQPrRQWvPkbf4PbnfXTRfdT57pm2NC6SCTD62I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)