UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1CEN66IYkvkFx+f3m3HrUSeI12elrG3jpiknBrSPDYM='
WHERE
key_id = 'a3ec82bd717f942a47809fd070bfa9d59fc2bfdcce31f1e2d9a7115b8bb92256'
AND (
token = '1CEN66IYkvkFx+f3m3HrUSeI12elrG3jpiknBrSPDYM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)