UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gQxePNri66QidUWqMXut1e4Q1JdmnjPipB0WT4HTdgc='
WHERE
key_id = 'ccb4228d9e7148262a028ef25a084c83ac080c2cde064ea9e362fefda9966dab'
AND (
token = 'gQxePNri66QidUWqMXut1e4Q1JdmnjPipB0WT4HTdgc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)