UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wZSnFM+oJfZfeNgPIXTnW/Mbelnm4FjblR0ysoOIJqI='
WHERE
key_id = '7aef67835b41f2b8bff4e3b58ff355a9b2666c146bbf7846b7adfdaa6e038020'
AND (
token = 'wZSnFM+oJfZfeNgPIXTnW/Mbelnm4FjblR0ysoOIJqI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)