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