UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '78O6ZhmrkCiKCQGm4vmwCKUUcL0t9I7T1SvZz4TtRlc='
WHERE
key_id = '012d8cc7fb7ac2ae7a0c924842673e7e0cc848abec3a64b22f8599272823dbef'
AND (
token = '78O6ZhmrkCiKCQGm4vmwCKUUcL0t9I7T1SvZz4TtRlc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)