UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0ggX5qnXvdMSzAQ6sbGgd5ENNEVBYRU+K44ABNoLOr4='
WHERE
key_id = '617af513c3605e96e32606a665408e77e78261fffd238883bda7fcd1e59f77e3'
AND (
token = '0ggX5qnXvdMSzAQ6sbGgd5ENNEVBYRU+K44ABNoLOr4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)