UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '71QU7fYVt+cIb0t1KV8DGFlXlaX7dBNGgUHwuij7RW4='
WHERE
key_id = '615af1c0c48a2fe04af6c32e94305273c7e7047c1ddba1065f52d2e24e7be41a'
AND (
token = '71QU7fYVt+cIb0t1KV8DGFlXlaX7dBNGgUHwuij7RW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)