UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+X8hT8Xc0gFKdsr6zuZ8LtqATsYZulOnf1Zy0j2Vy7o='
WHERE
key_id = '506a2f4fa4603475c8c6bee9c6c01f764aaa2667c0b69fa88bc9e4d395f57234'
AND (
token = '+X8hT8Xc0gFKdsr6zuZ8LtqATsYZulOnf1Zy0j2Vy7o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)