UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7fDeVk491td2L89AsL0TacGui/eW1zZociFb4bevHbs='
WHERE
key_id = '55caedeca48e28b91cb7a3def4ce365a525f82711e2c21b2d90e197c877a11ee'
AND (
token = '7fDeVk491td2L89AsL0TacGui/eW1zZociFb4bevHbs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)